# -*- coding: utf-8 -*-
# @Time    : 2024/8/30 下午7:53
# @Author  : wb
# @Email   : wb@163.com
# @File    : marking_add_template
# @Software: PyCharm

from time import sleep
from pages.wb_base_page import BasePage
from selenium.webdriver.common.by import By
class MarkingModifyTemplatePage(BasePage):
    url = '/crm'

    # 定位器
    '''获取模板名称输入框元素'''
    template_name_locator = (By.CSS_SELECTOR, '#dialog-edit > form > table > tbody > tr:nth-child(2) > td:nth-child(2) > input')
    '''获取邮件主题输入框元素'''
    template_subject_locator = (By.CSS_SELECTOR, '#dialog-edit > form > table > tbody > tr:nth-child(3) > td:nth-child(2) > input')
    '''获取邮件内容输入框元素'''
    template_content_locator = (By.CSS_SELECTOR, '#content')
    '''获取保存按钮元素'''
    save_locator = (By.CSS_SELECTOR, '#dialog-edit > form > table > tfoot > tr > td > input.btn.btn-primary')

    #浏览器操作
    def clear_modify_template_name(self):
        # 清空模板名称
        self.driver.find_element(*self.template_name_locator).clear()

    def input_modify_template_name(self,template_name):
        # 输入模板名称
        self.driver.find_element(*self.template_name_locator).send_keys(template_name)

    def clear_modify_template_subject(self):
        # 清空模板名称
        self.driver.find_element(*self.template_subject_locator).clear()

    def input_modify_template_subject(self,template_subject):
        # 输入模板主题
        self.driver.find_element(*self.template_subject_locator).send_keys(template_subject)

    def clear_modify_template_content(self):
        # 清空内容名称
        self.driver.find_element(*self.template_content_locator).clear()

    def input_modify_template_content(self,template_content):
        # 输入邮件内容
        self.driver.find_element(*self.template_content_locator).send_keys(template_content)

    def click_modify_save(self):
        # 点击保存
        self.driver.find_element(*self.save_locator).click()
        sleep(3)








